package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Parents;
import com.bohua.child.service.ParentsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 家长表控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/parents")
public class ParentsController {
    @Resource
    private ParentsService parentsService;

    @RequestMapping
    public String parents(){
        return "parents/parents.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "parents/addParents.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "parents/updateParents.html";
    }

    @RequestMapping("/getParentss")
    @ResponseBody
    public Lay getParentss(Parents parents,Integer page,Integer limit){
        return parentsService.getParentss(parents,page,limit);
    }
    @RequestMapping("/addParents")
    @ResponseBody
    public Msg addParents(Parents parents){
        return parentsService.addParents(parents);
    }

    @RequestMapping("/updateParents")
    @ResponseBody
    public Msg updateParents(Parents parents){
        return parentsService.updateParents(parents);
    }

    @RequestMapping("/delParents")
    @ResponseBody
    public Msg delParents(Parents parents){
        return parentsService.delParents(parents);
    }
}
